package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.report.script.core.FunctionHelper;

public class RADIANS extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Object localObject = paramArrayOfObject[0];
    if (localObject instanceof Number)
      return FunctionHelper.parsePrimitiveDouble(Math.toRadians(((Number)localObject).doubleValue()));
    return Primitive.ERROR_NAME;
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "RADIANS(angle): 将角度转换成弧度。\nAngle:需要转换为弧度的角度。\n示例:\nRADIANS(90)等于1.570796327（π/2弧度）。";
  }

  public String getEN()
  {
    return "RADIANS(angle): Converts degrees to radians.\nAngle is an angle in degrees that you want to convert.\n\nExample:\nRADIANS(90) = 1.570796327 (π/2 in radians)";
  }
}